//
//  main.m
//  MacTestProject
//
//  Created by LiuLichen on 2022/3/20.
//

#import <Foundation/Foundation.h>

#import <objc/runtime.h>

#import "Class/ClassTest.h"
#import "Class/ClassClusterTest.h"
#import "Class/AutoDictionary.h"
#import "Class/NSString+MyAddition.h"
#import "Class/ARCTest.h"
#import "Class/ASyncURLConnection.h"
#import "Foundation/StringTest.h"
#import "Foundation/ArrayTest.h"
#import "Foundation/DictionaryTest.h"
#import "Foundation/NumberTest.h"
#import "Foundation/EnumTest.h"
#import "Foundation/SetTest.h"
#import "Foundation/BlockTest.h"
#import "Foundation/GCDTest.h"
#import "File/PlistTest.h"
#import "File/FileManagerTest.h"


int main(int argc, const char* argv[]) {
    @autoreleasepool {
        NSLog(@"//////////////////////////ClassTest//////////////////////////");
        NSLog(@"%@", [[ClassTest alloc]init]);
        NSLog(@"//////////////////////////ClassClusterTest//////////////////////////");
        NSLog(@"%@", [[ClassClusterTest alloc]init]);
        NSLog(@"//////////////////////////AutoDictionary//////////////////////////");
        {
            AutoDictionary* dict = [AutoDictionary new];
            NSLog(@"%@", dict);
            dict.date = [NSDate dateWithTimeIntervalSince1970: 475372800];
            NSLog(@"dict date = %@", dict.date);        // dict.date = 1985-01-24 00:00:00 +0000
        }
        NSLog(@"//////////////////////////NSString+MyAddition//////////////////////////");
        {
            Method originalMethod = class_getInstanceMethod([NSString class], @selector(lowercaseString));
            Method swappedMethod = class_getInstanceMethod([NSString class], @selector(myLowercaseString));
            method_exchangeImplementations(originalMethod, swappedMethod);
            NSString* str = @"ThIs iS tHe StRiNg";
            NSString* lowercase = [str lowercaseString];        // Output: ThIs iS tHe StRiNg => this is the string
            NSLog(@"%@", lowercase);
            method_exchangeImplementations(originalMethod, swappedMethod);
            lowercase = [str lowercaseString];                  // No output
        }
        NSLog(@"//////////////////////////ARCTest/////////////////////////");
        NSLog(@"%@", [[ARCTest alloc]init]);
        NSLog(@"//////////////////////////ASyncURLConnection/////////////////////////");
        NSLog(@"%@", [[ASyncURLConnection alloc]init]);

        NSLog(@"//////////////////////////StringTest//////////////////////////");
        NSLog(@"%@", [[StringTest alloc]init]);
        NSLog(@"//////////////////////////ArrayTest//////////////////////////");
        NSLog(@"%@", [[ArrayTest alloc]init]);
        NSLog(@"//////////////////////////DictionaryTest//////////////////////////");
        NSLog(@"%@", [[DictionaryTest alloc]init]);
        NSLog(@"//////////////////////////NumberTest//////////////////////////");
        NSLog(@"%@", [[NumberTest alloc]init]);
        NSLog(@"//////////////////////////EnumTest//////////////////////////");
        NSLog(@"%@", [[EnumTest alloc]init]);
        NSLog(@"//////////////////////////SetTest//////////////////////////");
        NSLog(@"%@", [[SetTest alloc]init]);
        NSLog(@"//////////////////////////BlockTest//////////////////////////");
        NSLog(@"%@", [[BlockTest alloc]init]);
        NSLog(@"//////////////////////////GCDTest//////////////////////////");
        NSLog(@"%@", [[GCDTest alloc]init]);

        NSLog(@"//////////////////////////PlistTest//////////////////////////");
        NSLog(@"%@", [[PlistTest alloc]init]);
        NSLog(@"//////////////////////////FileManagerTest//////////////////////////");
        NSLog(@"%@", [[FileManagerTest alloc]init]);
    }
    return 0;
}
